create or replace function is_idcard(p_card varchar2) return boolean is
  idcardlen integer;
begin
  idcardlen := length(trim(p_card));
  
  if(idcardlen=18 and is_number(substr(p_card,1,idcardlen-1))
  or (idcardlen=15 and is_number(p_card)))
  
  then 
  return true;
  
  else
    return false;
    end if;
    
end is_idcard;
/
